
#include <BTaskThread>

using namespace BWE;

BTaskThread::BTaskThread()
{

}
BTaskThread::~BTaskThread()
{

}

int BTaskThread::run()
{
	while (!stop())
	{
		BTaskHolder task = _taskQueue->pop();

		if(task)
		{
			bool success = (*task.ptr())();
			if(success)
			{
				_taskQueue->finish(task.ptr());
			}
		}
		else
		{
			sleep();
		}
	}
	return 0;
}
